// src/components/DashboardLayout.jsx
import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import { FaHome, FaImage, FaInfoCircle, FaMicroscope } from 'react-icons/fa';

import '../css/DashboardLayout.css';


const DashboardLayout = ({ children }) => {
  const location = useLocation();

  return (
    <div className="dashboard">
      {/* 左侧导航栏 */}
      <aside className="sidebar">
        <div className="logo">👁️ 眼疾识别</div>
        <nav>
          <ul>
            <li className={location.pathname === '/' ? 'active' : ''}>
              <Link to="/"><FaHome /> 首页</Link>
            </li>
            <li className={location.pathname === '/upload' ? 'active' : ''}>
              <Link to="/upload"><FaImage /> 图片检测</Link>
            </li>
            <li className={location.pathname === '/read-more' ? 'active' : ''}>
              <Link to="/read-more"><FaInfoCircle /> 了解更多</Link>
            </li>
            <li className={location.pathname === '/diseases' ? 'active' : ''}>
  <Link to="/diseases"><FaMicroscope /> 疾病介绍</Link>
</li>

          </ul>
        </nav>
      </aside>

      {/* 主体内容区 */}
      <div className="main-content">
        <header className="topbar">
          <span>当前位置：{location.pathname}</span>
        </header>

        <div className="page-content">
          {children}
        </div>
      </div>
    </div>
  );
};

export default DashboardLayout;
